package com.sinoatma.physignsmonitor.adapter



import android.annotation.SuppressLint
import android.view.View
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.clj.fastble.data.BleDevice
import com.common.frame.base.BaseAdapter
import com.common.frame.base.getColorInt
import com.sinoatma.physignsmonitor.MyApp
import com.sinoatma.physignsmonitor.R
import com.sinoatma.physignsmonitor.bean.BpDataBean
import com.sinoatma.physignsmonitor.databinding.BpListLayoutBinding
import com.sinoatma.physignsmonitor.databinding.DeviceListLayoutBinding

@SuppressLint("MissingPermission")
class BpBleAdapter(data: MutableList<BpDataBean>?) : BaseAdapter<BpDataBean,BpListLayoutBinding>(R.layout.bp_list_layout,data) {
    @SuppressLint("ResourceAsColor")
    override fun convert(holder: BaseDataBindingHolder<BpListLayoutBinding>, item: BpDataBean) {
      holder.dataBinding?.run {
            tvBp.text="血压 ${item.h_pressure}/${item.l_pressure}mmHg"
            tvBpTime.text="时间 ${item.time}"
            if (item.bloodPressureStatus=="0"){
                tvBpStatus1.text="正常"
                tvBpStatus1.visibility=View.VISIBLE
                tvBpStatus2.visibility=View.GONE
            }else{
                tvBpStatus1.visibility=View.GONE
                tvBpStatus2.visibility=View.VISIBLE
              if (item.bloodPressureStatus=="1") {
                  tvBpStatus2.text = "偏高"
                } else {
                  tvBpStatus2.text = "偏低"
                }

            }

      }
    }
}




